package com.fastCms.business.bim.manage.impl;

import com.alibaba.fastjson.JSON;
import com.fastCms.business.bim.manage.GpsManageService;
import com.fastCms.business.bim.pojo.entity.DataRepair;
import com.fastCms.business.bim.service.DataRepairService;
import com.fastCms.business.frame.utils.CommonsUtil;
import com.fastCms.business.frame.utils.gps.GpsUtil;
import com.fastCms.business.frame.utils.gps.TrackVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class GpsManageServiceImpl implements GpsManageService {
    @Autowired
    private DataRepairService dataRepairServiceImpl;

    @Override
    public void getCarTrack() {
        String imei = "";
        TrackVO track = GpsUtil.getTrack(imei);
        if (null != track) {
            DataRepair dataRepair = new DataRepair();
            CommonsUtil.initEntity(dataRepair);
            dataRepair.setJsonData(JSON.toJSONString(track));
            dataRepair.setStatus(Integer.valueOf(track.getStatus()));
            dataRepairServiceImpl.save(dataRepair);
        }
    }
}

